<?php
require_once(".././controller/banco.php");

session_start();

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" 
  "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>
      menu
    </title>
    <link rel="Stylesheet" href="./css/sisconc.css" type="text/css" />
    <script type="text/javascript" src="./js/sisconc.js">
    </script>
  </head>
  <body>
    <div class="box">
    <form method="post" action="<?php $_SERVER['PHP_SELF']?>">
	    <fieldset>
		  <legend>
		    <img src="./img/logo.jpg" alt="logotipo" />
		  </legend>
<?php		  
if(!(empty($_POST['cpf'])))
  {
  $banco2a = new BANCO();		
  
  $sql2a = "DELETE FROM usuario_departamento WHERE cpf_usuario=" . $_POST['cpf'] ;
  $banco2a->ExecutaSQL($sql2a);
  unset($banco2a);  
  
  
  $banco2b = new BANCO();		
  
  $sql2b = "DELETE FROM usuario WHERE cpf=" . $_POST['cpf'] ;
  $banco2b->ExecutaSQL($sql2b);
  unset($banco2b);
  echo "<div class=\"alert\">Usu&aacute;rio removido com sucesso</div>";
  }	
?>  
		    <select name="cpf">
<?php
$banco = new BANCO();
				
$vetortemporario = $banco->ExecutaSQL("SELECT cpf, nome FROM usuario ORDER BY cpf;");
for($x = 0; $x < $banco->RetornaQuantidadeLinhas() ; $x++) 
  {
  echo "              <option value=\"" . $vetortemporario[$x][0] .  "\"> CPF:" . $vetortemporario[$x][0] . " - Nome: " . $vetortemporario[$x][1] . "</option>\n";   
  }
unset($banco);
?>
            </select><br />	
		  <input type="submit" name="Submit" value="Remover" />
		  <br />
            <a href="usuario.php">voltar</a><br />
		</fieldset>  
	  </form>
	</div>
  </body>
</html>
